﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace BanVeXemPhim_Presentation
{
    public partial class UserControlGhe_admin : UserControl
    {
        public UserControlGhe_admin()
        {
            InitializeComponent();
        }

        private int _hang;
        private int _cot;
        private int _idGhe;
        private int _tinhTrang;
        private int _loaiGhe=2;

        public int Hang
        {
            get { return _hang; }
            set { _hang = value; }
        }

        public int Cot
        {
            get { return _cot; }
            set { _cot = value; }
        }

        public int IdGhe
        {
            get { return _idGhe; }
            set { _idGhe = value; }
        }

        public int TinhTrang
        {
            get { return _tinhTrang; }
            set
            {
                _tinhTrang = value;
                if (_tinhTrang == 1)
                {
                    pictureBox1.Image = Properties.Resources.GheTrong;
                }
                else if (_tinhTrang == 0)
                {
                    pictureBox1.Image = Properties.Resources.DaBan;
                }
            }
        }

        public int LoaiGhe
        {
            get { return _loaiGhe; }
            set
            {
                _loaiGhe = value;
                if(_loaiGhe!=null)
                {
                    if (_loaiGhe == 1)
                    {
                        this.pictureBoxHinhAnhGheVip.Visible = true;
                    }
                    else
                        this.pictureBoxHinhAnhGheVip.Visible = false;

                }
            }
        }


        private void pictureBox1_MouseHover(object sender, EventArgs e)
        {
            string s = "";
            if(_tinhTrang==0)
                s = "Hư hỏng";
            else s = "Đang sử dụng";
            this.toolTip1.SetToolTip(this.pictureBox1, "Hàng:" + _hang.ToString() + "\nCột:" + _cot.ToString() + "\nTình trạng:"+s);
        }



        private void pictureBoxHinhAnhGheVip_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                if (_tinhTrang == 0)
                {
                    _tinhTrang = 1;
                    pictureBox1.Image = Properties.Resources.GheTrong;
                }
                else if (_tinhTrang == 1)
                {
                    _tinhTrang = 0;
                    pictureBox1.Image = Properties.Resources.DaBan;
                }
            }
            else if (e.Button == MouseButtons.Right)
            {

                this.contextMenuStrip1.Show(this, e.X, e.Y);
            }
        }

        private void pictureBox1_MouseClick(object sender, MouseEventArgs e)
        {
            if(e.Button==MouseButtons.Left)
            {
                if (_tinhTrang == 0)
                {
                    _tinhTrang = 1;
                    pictureBox1.Image = Properties.Resources.GheTrong;
                }
                else if (_tinhTrang == 1)
                {
                    _tinhTrang = 0;
                    pictureBox1.Image = Properties.Resources.DaBan;
                }
            }
            else if(e.Button==MouseButtons.Right)
            {

                this.contextMenuStrip1.Show(this,e.X,e.Y);
            }

        }

        private void ghếVipToolStripMenuItem_Click(object sender, EventArgs e)
        {
            LoaiGhe = 1;
        }

        private void ghếThườngToolStripMenuItem_Click(object sender, EventArgs e)
        {
            LoaiGhe = 2;
        }

        private void ghếĐangHoạtĐộngToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TinhTrang = 1;
        }

        private void ghếKhôngHoạtĐộngToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TinhTrang = 0;
        }

        private void pictureBoxHinhAnhGheVip_MouseHover(object sender, EventArgs e)
        {
            string s = "";
            if (_tinhTrang == 0)
                s = "Hư hỏng";
            else s = "Đang sử dụng";
            this.toolTip1.SetToolTip(this.pictureBox1, "Hàng:" + _hang.ToString() + "\nCột:" + _cot.ToString() + "\nTình trạng:" + s);
        }



    }
}
